#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
void swap(int* a, int* b)
{
	int t = *a;
	*a = *b;
	*b = t;
}
int main()
{
	int n, m, i, j, k;
	scanf("%d %d", &m, &n);
	int arr[100][100] = { 0 };
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf("%d", &arr[i][j]);
		}
	}
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n-1; j++)
		{
			for (k = 0; k < n - j - 1; k++)
			{
				if (arr[i][k] > arr[i][k + 1])
				{
					swap(&arr[i][k], &arr[i][k + 1]);
				}
			}
		}
	}
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
	return 0;
}